﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Liabilities_Receiver.ascx.cs" Inherits="ERP.Modules.Liabilities_Receiver" %>

<%-------------------------------%>
<ext:Hidden ID="FormatTypeLiabilities_Receiver" runat="server" />
<%--------------GridLiabilities_Receiver-----------------%>
<ext:Panel runat="server" Layout="Fit" Border="False" ID="PanelLiabilities_Receiver">
    <Content>
        <ext:GridPanel
            ID="grLiabilities_Receiver"
            runat="server"
            Cls="grid-double"
            EnableColumnMove="true"
            Border="False">
            <Store>
                <ext:Store
                    ID="StoreLiabilities_Receiver"
                    runat="server"
                    OnReadData="StoreLiabilities_Receiver_RefreshData"
                    PageSize="20">
                    <Model>
                        <ext:Model ID="ModelLiabilities_Receiver" runat="server" GroupField="Customer_Name">
                            <Fields>
                                <ext:ModelField Name="FullName" Type="String" />
                                <ext:ModelField Name="VoucherAmount" Type="Int" />
                                <ext:ModelField Name="Remain" Type="Int" />
                                <ext:ModelField Name="Have_Receiver" Type="Int" />
                                <ext:ModelField Name="Sell_DateBegin" Type="Date" />
                                <ext:ModelField Name="Sell_Code" Type="String" />
                                <ext:ModelField Name="ReceiptReasonName" Type="String" />
                                <ext:ModelField Name="Customer_Alias" Type="String" />
                                <ext:ModelField Name="Customer_Name" Type="String" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:RowNumbererColumn runat="server" Text="STT" Width="30" Align="Center" />
                    <ext:Column runat="server" Text="Người bán" Width="130" DataIndex="FullName"/>
                    <ext:Column runat="server" Text="Chứng từ" Width="100" DataIndex="Sell_Code"/>
                    <ext:DateColumn runat="server" Text="Ngày bán" Width="100" DataIndex="Sell_DateBegin" Format="dd-MM-yyyy"/>
                    <ext:Column runat="server" Text="Mã khách hàng" Width="100" DataIndex="Customer_Alias"/>
                    <ext:Column runat="server" Text="Khách hàng" Width="180" DataIndex="Customer_Name"/>
                    <ext:Column runat="server" Text="Phải thu" Width="100" DataIndex="VoucherAmount">
                        <Renderer Handler="return indMoney(value);" />
                    </ext:Column>
                    <ext:Column runat="server" Text="Đã thu" Width="100" DataIndex="Have_Receiver">
                        <Renderer Handler="return indMoney(value);" />
                    </ext:Column>
                    <ext:Column runat="server" Text="Còn lại" Width="100" DataIndex="Remain">
                        <Renderer Handler="return indMoney(value);" />
                    </ext:Column>
                    <ext:Column runat="server" Text="Loại" Width="100" DataIndex="ReceiptReasonName" Flex="1"/>
                </Columns>
            </ColumnModel>
            <Features>
                <ext:Grouping
                    runat="server" 
                    HideGroupedHeader="true"
                    GroupByText="Xem theo phân nhóm"
                    ShowGroupsText="Phân nhóm"
                    GroupHeaderTplString="{name} ({rows.length} danh mục con {[values.rows.length > 1 ? '' : '']})"
                    StartCollapsed="True" />
            </Features>
            <View>
                <ext:GridView ID="GridView1" runat="server" StripeRows="true" />
            </View>
            <DockedItems>
                <ext:Toolbar ID="ToolbarTopMain" runat="server" Dock="Top">
                    <Items>
                        <ext:Button ID="btnExport" runat="server" Text="Xuất tập tin" Icon="Printer">
                            <Menu>
                                <ext:Menu ID="MenuMain" runat="server">
                                    <Items>
                                        <ext:MenuItem ID="MenuItemExportXML" runat="server" Text="XML" Icon="PageCode">
                                            <Listeners>
                                                <Click Handler="submitValue(#{grLiabilities_Receiver}, #{FormatTypeLiabilities_Receiver}, 'xml');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:SelectBox
                            ID="SelectBoxLiabilitiesReceiver"
                            runat="server"
                            Cls="x-select-box"
                            DisplayField="Customer_Name"
                            ValueField="Customer_ID"
                            MarginSpec="0 8 0 0"
                            EmptyText="Chọn nhà cung cấp">
                            <Store>
                                <ext:Store ID="StoreLiabilitiesReceiver" runat="server">
                                    <Model>
                                        <ext:Model runat="server">
                                            <Fields>
                                                <ext:ModelField Name="Customer_Name" />
                                                <ext:ModelField Name="Customer_ID" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <DirectEvents>
                                <Select OnEvent="SelectBoxLiabilitiesReceiver_Change">
                                    <EventMask ShowMask="true" Msg="Đang tải..."></EventMask>
                                </Select>
                            </DirectEvents>
                        </ext:SelectBox>
                        <ext:ToolbarSeparator />
                        <ext:DateField ID="txtDateBeginFillter" EmptyText="Từ ngày" runat="server" MarginSpec="0 8 0 0"/>
                        <ext:DateField ID="txtDateEndFillter" EmptyText="Đến ngày" runat="server" MarginSpec="0 5 0 0"/>
                        <ext:Button ID="btnFillter" runat="server" Text="Lọc" Icon="ApplicationGo" ToolTip="Chọn lọc theo ngày đặt hàng">
                            <DirectEvents>
                                <Click OnEvent="btnFillter_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
                <ext:Toolbar ID="ToolbarPagging" runat="server" Dock="Bottom" AnchorHorizontal="100%">
                    <Items>
                        <ext:TriggerField ID="txtSearch" runat="server" Width="200" EnableKeyEvents="true" MarginSpec="0 8 0 0">
                            <Triggers>
                                <ext:FieldTrigger Icon="Search" />
                            </Triggers>
                            <DirectEvents>
                                <TriggerClick OnEvent="Search_Event"></TriggerClick>
                                <SpecialKey OnEvent="Search_Event" Before="return e.getKey() == Ext.EventObject.ENTER;">
                                     <EventMask ShowMask="true" Msg="Đang tải..." />
                                </SpecialKey>
                            </DirectEvents>
                        </ext:TriggerField>
                        <ext:PagingToolbar ID="PagingToolbarLiabilities_Receiver" runat="server" StoreID="StoreLiabilities_Receiver" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                    </Items>
                </ext:Toolbar>
            </DockedItems>
        </ext:GridPanel>
    </Content>
</ext:Panel>